<?php

require_once 'Core/Content/Filter.php';

class Core_View_Filter_CoreNavigation extends Core_Content_Filter
{
    public $tag = 'coreNavigation';

    protected function _callback($matches)
    {
        $attribs = $this->getAttributes($matches[0]);
        if (is_array($attribs)) {
            $parentId  = isset($attribs['parent_id']) ? $attribs['parent_id'] : null;
            $root      = isset($attribs['root'])      ? $attribs['root']      : null;

            switch ($attribs['type']) {
                case 'menu':
                default:
                    return $this->view->menuRenderer($parentId, $attribs);
                    break;
                case 'submenu':
                    return $this->view->submenuRenderer($attribs);
                    break;
                case 'breadcrumbs':
                    return $this->view->breadcrumbsRenderer($root, $attribs);
                    break;
                case 'sitemap':
                    return $this->view->sitemapRenderer($attribs);
                    break;
            }
        }
        return null;
    }
}